﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace TourAgency.Admin.Modify
{
    public partial class EditHotelFacility : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["editHotelFacility"] != null)
                {
                    int editHotelFacilityID = int.Parse(Session["editHotelFacility"].ToString());
                    ToursAgencyDAL.HotelFacility editBoard = ToursAgencyDAL.ToursAgencyDataFuncs.GetHotelFacilityByID(editHotelFacilityID);
                    this.textBoxName.Text = editBoard.Name;
                }
            }
        }

        protected void buttonSaveHotelFacility_Click(object sender, EventArgs e)
        {
            ToursAgencyDAL.HotelFacility hotelFacility = new ToursAgencyDAL.HotelFacility();
            int editHotelFacilityID = int.Parse(Session["editHotelFacility"].ToString());
            hotelFacility.ID = editHotelFacilityID;
            hotelFacility.Name = this.textBoxName.Text;
            ToursAgencyDAL.ToursAgencyDataFuncs.EditHotelFacility(hotelFacility);
            Response.Redirect("~/Admin/HotelFacilities.aspx");
        }
    }
}